function data = loadPrelimConditions(thrustFilename,plotThings)
% function to load data structure
% inputs = thrustFilename,plotThings
% thrustFilename -> filename corresponding to thrust data, or numerical
% value if to be ignored and output zero thrust
% plotThings -> 0: don't plot children's stuff, 1: do plot stuff
% output = data -> data structure used by rocket ODE function

if (nargin < 1)
  plotThings = 0;
  thrustFilename = 0;
elseif nargin <2
    plotThings =0;
end

% thrustFilename = 'demoStaticTest.txt';

% if filename is a valid string/characters, load from filename, else output
% dummy zero thrust data
if ischar(thrustFilename)
    % load static thrust data
    [data.tt,data.thrust,nomForces] = loadThrustData(thrustFilename,plotThings);
    data.thrust = data.thrust;% * 4.448; %change thrust to Newtons
    
    %subtract off linear interp of offsets
    pvals = polyfit([data.tt(1),data.thrust(end-2)],nomForces,1);
    offsetVals = polyval(pvals,data.tt(1:end-2));
    data.thrust(1:end-2) = data.thrust(1:end-2) - offsetVals;
    data.thrust = data.thrust.*(data.thrust > 0);
    

else
    data.tt = [0,1e5];
    data.thrust = [0,0];
end


%% hardcode everything for now


% no wind (m/s)
data.wind = [0,0,0]';
% data.wind = [cosd(200-45),0,sind(200-45)]'*.44704;

% 45 deg initial heading in x-y plane
data.initH = [1,1,0]'/norm([1,1,0]);

% empty bottle mass (kg)
data.bottleMass = 0.130;

% initial water mass (kg)
data.initWMass = 1;

% air density (kg/m^3)
data.airDens = 1.225;

% rocket cross-sectional area (m^2)
data.bottleXArea = pi*(.1/2)^2;

% coefficient of drag
data.CD = 0.43;

% gravity vector (m/s^2)
data.gavec = [0,-9.81,0]';

% density of water/rocket fuel (kg/m^3)
data.rhoW = 1000;

% area of rocket nozzle (m^2)
data.nozzleArea = pi*(0.022/2)^2;

% data.bottleVol -> total volume of bottle
data.bottleVol = .0021; %cubic meters

% data.atmPress -> atmospheric pressure
data.atmPress = 84309.0922; %Pa for 5000 ft alt from standard atmosphere table

% data.initPressure -> fill pressure of bottle (Pa)
data.initPressure  = 275790.292 + data.atmPress; % pascals (40 psi converted to Pa)

% data.coeffDischarge -> discharge coefficient of nozzle
data.coeffDischarge = 1.;

% data.gamma -> specific heat ratio
data.gamma = 1.4;

% data.RealGasConst -> real gas constant for air
data.RealGasConst = 287.; %J*kg^-1*K^-1

% data.ambientTemp -> ambient tempt of water/gas/everything
data.ambientTemp = 298; %K
